package com.yhn.init.model.dto.orders;


import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import javax.validation.constraints.*;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * @author yhn
 * @version 1.0
 * @description
 * @date 2024/3/8 11:26
 */
@Data
public class OrdersAddRequest implements Serializable {

    @NotNull(message = "交付时间不能为空")
    @Future(message = "交付时间必须大于当前时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date deliveryDate;

    @NotNull(message = "交互完成尾款交互工作日不能为空")
    @Future(message = "交互完成尾款交互工作日必须大于当前时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date completionDate;

    @NotNull(message = "合同总额不能为空")
    @Min(value = 1, message = "合同总额必须大于0")
    private Integer contractAmount;

    @NotBlank(message = "客户姓名不能为空")
    @Size(min = 2, max = 50, message = "客户姓名长度需在2到50个字符之间")
    @Pattern(regexp = "^[\\u4e00-\\u9fa5]{2,10}$", message = "姓名必须符合格式")
    private String customerName;

    @NotBlank(message = "联系电话不能为空")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "联系电话格式不正确，请输入有效的手机号码")
    private String contactPhone;

    @NotBlank(message = "订单客户安装地址不能为空")
    @Size(min = 2, max = 200, message = "安装地址长度需在2到200个字符之间")
    private String installationAddress;

    @Serial
    private static final long serialVersionUID = 1L;
}
